<template>
  <view class="user">
    <view :style="'margin-top:' + nTop + 'px;--color:' + color + ';--rgbcolor:' + rgbcolor" class="topbar">
      <text v-for="(item, index) in topbar" :key="index" :class="'item ' + (currentTab == index ? 'active' : '')"
            :data-idx="index" @tap="topbarFn">
        {{ item }}
      </text>
    </view>
    <scroll-view
        :enableBackToTop="true"
        :enableFlex="true"
        :refresherEnabled="false"
        :refresherTriggered="triggered"
        :scrollTop="scrolltopNum_index"
        :scrollWithAnimation="true"
        :scrollY="true"
        :style="'--color:' + color + ';--rgbcolor:' + rgbcolor + ';'"
        class="ulist"
        lowerThreshold="300"
        @refresherrefresh="upFn"
        @scroll="binnd_scroll_index"
        @scrolltolower="btmFn"
    >
      <view class="sotab">
        <view :class="'li ' + pxclass" @tap="pxFn">
          <text class="span">排序</text>
          <text class="ico icon-jtbtm"></text>
        </view>
        <picker :range="pxSO.age.arr" :value="pxSO.age.def" class="li" headerText="请选择年龄" mode="multiSelector"
                rangeKey="v" @change="px_ageFn">
          <text class="span">年龄</text>
          <text class="ico icon-jtbtm"></text>
        </picker>
        <picker :range="pxSO.heigh.arr" :value="pxSO.heigh.def" class="li" headerText="请选择身高" mode="multiSelector"
                rangeKey="v" @change="px_heighFn">
          <text class="span">身高</text>
          <text class="ico icon-jtbtm"></text>
        </picker>
        <view :class="'li ' + somoreclass" @tap="moreFn">
          <text class="span">更多</text>
          <text class="ico icon-jtbtm"></text>
        </view>
      </view>
      <view v-if="sobox" class="soubox">
        <view :class="'a ' + (globalUtils.empty(sokind) || sokind == 'default' ? 'ed' : '')" data-sokind="default"
              @tap="souboxFn">默认排序
        </view>
        <view v-if="globalUtils.in_array('identity', rz_dataARR)" :class="'a ' + (sokind == 'identity' ? 'ed' : '')"
              data-sokind="identity"
              @tap="souboxFn">实名认证
        </view>
        <view v-if="globalUtils.in_array('photo', rz_dataARR)" :class="'a ' + (sokind == 'photo' ? 'ed' : '')"
              data-sokind="photo"
              @tap="souboxFn">真人认证
        </view>
        <view :class="'a ' + (sokind == 'regtime' ? 'ed' : '')" data-sokind="regtime" @tap="souboxFn">最新加入</view>
        <view :class="'a ' + (sokind == 'endtime' ? 'ed' : '')" data-sokind="endtime" @tap="souboxFn">最近登录</view>
        <view :class="'a ' + (sokind == 'click' ? 'ed' : '')" data-sokind="click" @tap="souboxFn">人气最高</view>
      </view>
      <view v-if="iModuleU === '1' && currentTab === 2 " class="SwipeCard">
        <SwipeCard :list="match" @change="handleChange" @like="handleLike" @pass="handlePass"/>
      </view>
      <view v-else-if="showtype == 1" class="list1">
        <Member :list="waterfallList" :nikbg="nikbg"></Member>
      </view>
      <view v-else :class="'list' + showtype">
        <block v-for="(dl, index) in ARR_index" v-if="ARR_index.length > 0" :key="index">
          <navigator v-for="(item, index1) in dl" :key="index1" :url="'/pagesA/u/u?uid=' + item.uid" class="a"
                     hoverClass="none">
            <!--            <block v-if="showtype == 1">
                          <view class="em">
                            <image :src="item.photo_m" class="m" mode="aspectFill"></image>
                            <view :style="'background:url(' + nikbg + ') repeat-x;background-size:100% 100%;'" class="nik">
                              <text class="span">{{ item.nickname }}</text>
                            </view>
                            <image v-if="!globalUtils.empty(item.vipj)" :src="item.vipj" class="vipj" mode="widthFix"></image>
                          </view>
                          <view class="uinfo">
                            <view class="data">
                              <view class="span">
                                <text class="font">{{ item.ageheighedu }}</text>
                              </view>
                              <view class="span">
                                <text v-if="!globalUtils.empty(item.areatitle)" class="b ico">{{ item.areatitle }}</text>
                                <text v-if="!globalUtils.empty(item.job)" class="b">{{ item.job }}</text>
                              </view>
                            </view>
                          </view>
                          <image v-if="!globalUtils.empty(item.rzj)" :src="item.rzj" class="rzj" mode="aspectFill"></image>
                        </block>-->
            <block v-if="showtype == 2">
              <image v-if="item.rz_store.length > 0" :src="item.rz_store" class="rz_store"></image>
              <view class="dt">
                <image :src="item.photo_m" class="m" mode="aspectFill"></image>
                <image v-if="!globalUtils.empty(item.vipj)" :src="item.vipj" class="vipj" mode="widthFix"></image>
              </view>
              <image v-if="!globalUtils.empty(item.rzj)" :src="item.rzj" class="rzj" mode="aspectFit"></image>
              <view class="dd">
                <view class="h4">
                  <text class="span">{{ item.nickname }}</text>
                  <image :src="item.grade_ico" class="ugrade1" mode="aspectFit"></image>
                </view>
                <text class="h6">{{ item.datainfo }}</text>
                <text class="h5">
                  <text
                      v-for="(rs2, index2) in item.hobby"
                      :key="index2"
                      :style="'color:' + color + ';background-color:rgba(' + rgbcolor + ',.05);border-color:rgba(' + rgbcolor + ',.1);'"
                      class="li"
                  >
                    {{ rs2 }}
                  </text>
                </text>
                <view v-if="item.photolist.length > 0" class="pathlist">
                  <image v-for="(pl, index2) in item.photolist" :key="index2" :class="item.photolist_cls" :src="pl"
                         mode="aspectFill"></image>
                </view>
              </view>
              <text v-if="!globalUtils.empty(item.distance_str)" class="gps">
                <text class="i ico"></text>
                {{ item.distance_str }}
              </text>
              <text class="em">
                <text class="div">{{ item.aboutus }}</text>
              </text>
              <view class="zoyq">
                <text :style="'background-color:' + color" class="li">寻觅</text>
                {{ item.zoyq }}
              </view>
            </block>

            <block v-else-if="showtype == 3">
              <view class="em">
                <image :src="item.photo_b" class="m" mode="widthFix"></image>
                <image v-if="!globalUtils.empty(item.vipj)" :src="item.vipj" class="vipj" mode="widthFix"></image>
              </view>
              <view class="uinfo">
                <view class="nik">
                  <view class="span">
                    <text class="h4">{{ item.nickname }}</text>
                    <image :src="item.grade_ico" class="ugrade2"></image>
                  </view>
                  <text class="font">{{ item.marrytime }}</text>
                </view>
                <view class="data">
                  <view class="span">
                    <text v-for="(item2, index2) in item.ageheighedupay" :key="index2" class="li">{{ item2 }}</text>
                  </view>
                  <view class="span">
                    <text class="i ico"></text>
                    {{ item.areatitle_str }}
                  </view>
                </view>
                <view class="about">{{ item.aboutus }}</view>
              </view>
              <image v-if="!globalUtils.empty(item.rzj)" :src="item.rzj" class="rzj" mode="aspectFill"></image>
              <view class="payrz">
                <view class="RZBOX">
                  <text v-for="(item2, index2) in item.RZarr"
                        :key="index2" :class="'i ico ' + item2.F + ' ' + item2.ed + ' ' + item2.size"></text>
                </view>
              </view>
            </block>
          </navigator>
        </block>
      </view>
      <view v-if="ARR_index_nodata" class="nodata">
        <image mode="aspectFit" src="/static/res/img/nodata.png"></image>
        暂无符合条件的用户　
        <text :style="'color:' + color" data-sokind="default" @tap="souboxFn">返回首页</text>
      </view>
      <view v-if="loading_flag " class="loading">
        <image v-if="loading_ico_flag" class="loading_ico" src="/static/res/img/loading_ico.svg"></image>
        <text>{{ loading_str }}</text>
      </view>
      <view v-if="guestloadP_flag" class="guestloadP">
        <navigator v-if="iflogin == 'mob'" :style="'--color:' + color + ';--rgbcolor:' + rgbcolor" class="btn5"
                   hoverClass="none" url="/pages/login/login">
          <text>完善资料</text>
          <text :style="'color: ' + color + ';'">浏览更多</text>
        </navigator>
        <navigator v-else-if="iflogin == 'reg'" :style="'--color:' + color + ';--rgbcolor:' + rgbcolor" class="btn5"
                   hoverClass="none" url="/pagesA/reg/reg">
          <text>完善资料</text>
          <text :style="'color: ' + color + ';'">浏览更多</text>
        </navigator>
      </view>
      <view class="blank">　</view>
    </scroll-view>
    <view v-if="showtype_box " :class="'mask2 ' + mask_class" data-maskid="showtype_box" @tap="showtype_box_closeFn">
      <view :style="'--color:' + color" class="showtype_box">
        <view :class="'a' + (showtype == 1 ? ' ed' : '')" data-value="1" @tap="showtype_setFn">
          <text class="i ico"></text>
          头像
        </view>
        <view :class="'a' + (showtype == 2 ? ' ed' : '')" data-value="2" @tap="showtype_setFn">
          <text class="i ico"></text>
          列表
        </view>
        <view :class="'a' + (showtype == 3 ? ' ed' : '')" data-value="3" @tap="showtype_setFn">
          <text class="i ico"></text>
          大图
        </view>
      </view>
    </view>
    <view v-if="!(iModuleU === '1' && currentTab === 2)"  :style="'--color:' + color + ';--rgbcolor:' + rgbcolor" class="btmKefuBtn loop_s_b_s" @tap="showtypeFn">
      <block v-if="showtype == 1">
        <view class="i ico"></view>
        头像
      </block>
      <block v-else-if="showtype == 2">
        <view class="i ico"></view>
        列表
      </block>
      <block v-else-if="showtype == 3">
        <view class="i ico"></view>
        大图
      </block>
    </view>
    <view v-if="index_so_flag" :class="'mask1 div_right_mask ' + index_so_mask_class"
          @tap.stop.prevent="index_so_closeFn">
      <view :class="'div_right_box ' + index_so_box_class" @tap.stop.prevent="emptyFn">
        <view class="div_left_so">
          <view class="tbody">嘉宾筛选</view>
          <form class="form_uid" style="margin-top: 34rpx" @submit="index_SO_uid_submitFn">
            <input
                :value="keyword"
                autocomplete="off"
                class="input"
                confirmType="search"
                maxlength="20"
                name="keyword"
                placeholder="按用户ID/昵称"
                type="text"
                @blur="index_SO_uid_bindblurFn"
                @confirm="index_SO_uid_submitFn2"
            />
            <button class="ico" formType="submit" style="z-index: 9"></button>
            <input hidden name="sokind" type="text" value="keyword"/>
          </form>
          <form :style="'--color:' + color + ';--rgbcolor:' + rgbcolor" class="form_ext" @submit="index_SO_submitFn"
                @reset.stop.prevent="index_SO_resetFn">
            <block v-for="(item, index) in SO" :key="index">
              <div v-if="item.fkind == 'range' || item.fkind == 'area'" class="listbox">
                <picker
                    v-if="item.fkind == 'area'"
                    :data-f="item.f"
                    :data-idx="index"
                    :data-kind="item.kind"
                    :headerText="'请选择' + item.tbody"
                    :range="item.arr.def"
                    :value="item.arr.idx"
                    class="dl"
                    mode="multiSelector"
                    rangeKey="v"
                    @change="areaidFn"
                    @columnchange="areaidChangeFn"
                >
                  <view class="dt">{{ item.tbody }}</view>
                  <view class="dd">
                    <view :class="'span' + (!globalUtils.empty(item.v) ? ' ed' : '')">{{ item.v }}</view>
                  </view>
                </picker>
                <picker
                    v-else
                    :data-f="item.f"
                    :data-index="index"
                    :headerText="'请选择' + item.tbody"
                    :range="item.arr.arr"
                    :value="item.arr.def"
                    class="dl"
                    mode="multiSelector"
                    rangeKey="v"
                    @change="rangFn"
                >
                  <view class="dt">{{ item.tbody }}</view>
                  <view class="dd">
                    <view :class="'span' + (!globalUtils.empty(item.v) ? ' ed' : '')">{{ item.v }}</view>
                  </view>
                </picker>
              </div>

              <block v-else>
                <view v-if="item.f == 'child'" class="listbox" @tap="vipFn">
                  <view class="dl listdl_tips">
                    <view class="dt">以下仅对VIP会员开放</view>
                    <view class="dd">
                      <view class="btn2">
                        <text class="i ico"></text>
                        开通VIP
                      </view>
                    </view>
                  </view>
                </view>
                <view class="tbox">
                  <view :class="'h5 ' + item.onoff + (item.auth == 'vip' ? ' C999' : '')"
                        :data-index="index" @tap.stop.prevent="index_SO_onoffFn">
                    {{ item.tbody }}
                  </view>
                  <view :class="'ul def ' + (item.ulcls == 'col2' ? item.ulcls : 'col3')"
                        :style="'display:' + (item.onoff == 'on' ? 'block' : 'none')">
                    <view
                        v-for="(item2, idx2) in item.arr"
                        :key="idx2"
                        :class="'li' + (globalUtils.indexOf(item.i, item2.i) ? ' ed' : '')"
                        :data-auth="item.auth"
                        :data-fkind="item.fkind"
                        :data-i="item2.i"
                        :data-idx="index"
                        @tap.stop.prevent="index_SO_liFn"
                    >
                      {{ item2.v }}
                    </view>
                  </view>
                </view>
              </block>

              <input :name="item.f" :value="item.i" hidden type="text"/>

              <input :name="item.f + '_str'" :value="item.v" hidden type="text"/>
            </block>
            <input hidden name="sokind" type="text" value="ext"/>
            <view class="savebox">
              <button class="reset" formType="reset">重置</button>
              <button class="ico" formType="submit"> 确定</button>
            </view>
            <view class="blank"></view>
          </form>
        </view>
      </view>
    </view>
    <view v-if="backtop_flag_index" :style="'color:' + color" class="backtop fadeInUp" data-id="index" @tap="backtopFn">
      <text class="ico icon-backtop"></text>
      顶部
    </view>
    <!-- parse <include src="../login.wxml"></include> -->
    <block>
      <view v-if="div_login" class="mask3 alpha0_100">
        <view
            class="div_box big_normal"
            style="--div_box_width: 82%; --div_box_height: 666rpx; background: -webkit-linear-gradient(top, #fde9ee 1%, #fff 150%); background-color: #fff"
        >
          <view :style="'border-color:rgba(' + rgbcolor + ',.2);'" class="m">
            <image mode="aspectFit" src="/static/res/img/photo_m.png"></image>
          </view>
          <view class="S22 B">登录后获得更精准推荐</view>
          <view class="loginagree">
            <checkbox-group @change="ifagreeFn">
              <label style="margin-left: -10rpx">
                <checkbox :style="'--color:' + color + ';'" value="1"></checkbox>
                <text class="C666 vmiddle">阅读并同意</text>
              </label>
            </checkbox-group>
            <navigator :style="'color:' + color" class="vmiddle" hoverClass="none"
                       url="/pagesA/about/law?kind=agreement">用户协议
            </navigator>
            <text class="C666 vmiddle">与</text>
            <navigator :style="'color:' + color + ';'" class="vmiddle" hoverClass="none"
                       url="/pagesA/about/law?kind=declara">隐私条款
            </navigator>
          </view>
          <button
              v-if="ifagree"
              :style="'--color:' + color + ';--rgbcolor:' + rgbcolor + ';width:73%'"
              class="btn5 W90_"
              openType="getPhoneNumber"
              @getphonenumber="getPhoneNumber"
          >
            <text>手机号快捷登录</text>
            <text :style="'color: ' + color + ';'">私密</text>
          </button>
          <button v-else :style="'--color:' + color + ';--rgbcolor:' + rgbcolor + ';width:73%'"
                  class="btn5" @tap="ifagree_passFn">
            <text>手机号快捷登录</text>
            <text :style="'color: ' + color + ';'">私密</text>
          </button>
          <view class="C666" @tap="back">
            <text style="border-bottom: #999 1px solid">暂不登录</text>
          </view>
        </view>
      </view>
    </block>
    <!-- parse <include src="../component/sorry.wxml"></include> -->
    <block>
      <view v-if="div_vip" :class="'mask2 ' + mask_class" data-maskid="div_vip" @tap="mask_closeFn">
        <view :style="'--div_box_width:600rpx;--div_box_height:' + (div_vip_H > 0 ? div_vip_H : 480) + 'rpx;'"
              class="div_box div_vip"
              @tap.stop.prevent="emptyFn">
          <view class="closebtm ico" data-maskid="div_vip" @tap.stop.prevent="mask_closeFn"></view>
          <view class="h1">{{ div_vip_title }}</view>
          <text v-if="!globalUtils.empty(div_vip_content)" class="C S15">{{ div_vip_content }}</text>
          <block v-else>
            <view class="C S15">开通VIP超级会员，专享超值权益</view>
            <view class="C S15">相亲成功率大大提升</view>
          </block>
          <view class="ico picico"></view>
          <view class="btn_btm btn44 ico" @tap.stop.prevent="vipFn"> 立即开通</view>
        </view>
      </view>
      <view v-if="div_cert" :class="'mask2 ' + mask_class" data-closekind="back" data-maskid="div_cert"
            @tap="mask_closeFn">
        <view class="div_box div_cert" style="--div_box_width: 600rpx; --div_box_height: 480rpx"
              @tap.stop.prevent="emptyFn">
          <view class="closebtm ico" data-closekind="back" data-maskid="div_cert" @tap.stop.prevent="mask_closeFn">
          </view>
          <view class="h1">{{ div_cert_title }}</view>
          <view class="C S15">成为认证用户，即享沟通特权</view>
          <view class="C S15">提高诚信值，杜绝虚假</view>
          <view class="ico picico"></view>
          <view class="btn_btm btn44 ico" @tap.stop.prevent="certFn">立即认证</view>
        </view>
      </view>
      <view v-if="div_data" :class="'mask2 ' + mask_class" data-closekind="back" data-maskid="div_data"
            @tap="mask_closeFn">
        <view :style="'--div_box_width:600rpx;--div_box_height:490rpx;--color:' + color + ';--rgbcolor:' + rgbcolor"
              class="div_box div_data"
              @tap.stop.prevent="emptyFn">
          <view class="closebtm ico" data-closekind="back" data-maskid="div_data" @tap.stop.prevent="mask_closeFn">
          </view>
          <view class="h1">{{ div_data_title }}</view>
          <view class="C S15">赶快去完善，解锁更多功能</view>
          <view class="C S15">完成资料，上传头像，受关注度暴增</view>
          <view class="C S15 Cf00">如果还未审核，请等待审核</view>
          <view class="ico picico"></view>
          <view class="btn_btm btn44 ico" @tap.stop.prevent="dataFn">立即完善</view>
        </view>
      </view>
      <view v-if="div_gps" :class="'mask2 ' + mask_class" data-closekind="back" data-maskid="div_gps"
            @tap="mask_closeFn">
        <view :style="'--div_box_width:550rpx;--div_box_height:480rpx;--color:' + color + ';--rgbcolor:' + rgbcolor"
              class="div_box div_gps"
              @tap.stop.prevent="emptyFn">
          <view class="closebtm ico" data-closekind="back" data-maskid="div_gps" @tap.stop.prevent="mask_closeFn">
          </view>
          <view class="h1">{{ div_gps_title }}</view>
          <view class="C S15">授权后，将自动获取您当前位置</view>
          <view class="C S15">否则将无法使用《附近的人》功能</view>
          <view class="ico picico"></view>
          <view class="btn_btm btn44 ico" @tap.stop.prevent="gpsFn">同意获取位置</view>
        </view>
      </view>
    </block>
    <privacy-popup @agree="privacy_agree" @disagree="privacy_disagree"></privacy-popup>
  </view>
</template>
<script>
import privacyPopup from '../../components/privacyPopup/privacyPopup';
import globalUtils from "../../res/www.a9a.cn";
import Member from "../../components/member/member.vue";
import SwipeCard from "../../components/SwipeCard/SwipeCard.vue";

var a;
var t = require('../../@babel/runtime/helpers/defineProperty');
var e = require('../../res/www.a9a.cn.js');
var i = 2;
var n = true;
var app = getApp();
var r = uni.getStorageSync('COOK_U');
export default {
  computed: {
    globalUtils() {
      return globalUtils
    }
  },
  components: {
    SwipeCard,
    Member,
    privacyPopup
  },
  data() {
    return {
      aid: 0,
      singlePage: false,
      currentTab: 0,
      mask_class: 'alpha0_100',
      ARR_index_nodata: false,
      triggered: true,
      loading_flag: false,
      loading_ico_flag: false,
      loading_str: '拼命加载中',
      backtop_flag_index: false,
      color: '',
      rgbcolor: '',
      nikbg: '',
      ARR_index: [],
      waterfallList: [], // 瀑布流数据
      match: [], // 瀑布流数据
      pxclass: '',
      sobox: false,
      sokind: '',
      topbar: [],
      iModuleU: '',
      showtype: '',
      rz_dataARR: '',
      SHARE: '',
      pxSO: {
        age: {
          arr: [],
          def: ''
        },

        heigh: {
          arr: [],
          def: ''
        }
      },

      SO: '',
      areaidARR: '',
      area2idARR: '',
      showtype_box: false,
      div_gps: false,
      guestloadP_flag: false,
      iflogin: '',
      somoreclass: '',
      keyword: '',
      div_login: false,
      ifagree: false,
      nTop: '',
      scrolltopNum_index: 0,
      dl: [],
      rs2: [],
      pl: '',
      idx2: 0,
      div_vip: '',
      div_vip_H: 0,
      div_vip_title: '',
      div_vip_content: '',
      div_cert: '',
      div_cert_title: '',
      div_data: '',
      div_data_title: '',
      div_gps_title: '',
      index_so_flag: false,
    };
  },
  onLoad: function (a) {
    var that = this;
    app.globalData.get_config('_ZEAI').then(function (a) {
      that.setData({
        color: app.globalData._ZEAI.color,
        rgbcolor: e.c16_rgb(app.globalData._ZEAI.color),
        nikbg: app.globalData.WWW + '/res/m/img/nikbg.png'
      });
    });
    app.globalData.get_navigationBarTopHeight(that);
    app.globalData.get_openid().then(function (a) {
      that.init();
    });
    that.init();

    e.empty(app.globalData.aid) ||
    that.setData({
      aid: app.globalData.aid
    });
    uni.getSystemInfo({
      success: function (a) {
        if ('singlePage' == a.mode) {
          that.init();
        } else {
          app.globalData.get_openid().then(function (a) {
            that.init();
          });
        }
      }
    });
  },
  onShow: function () {
    var that = this;
    if (that.aid != app.globalData.aid) {
      that.setData({
        aid: app.globalData.aid
      });
      return void that.upFn();
    }
    if (e.empty(app.globalData.hn_par)) {
      if (e.empty(app.globalData.index_par)) {
        r = uni.getStorageSync('COOK_U');
        if (app.globalData.empty(r)) {
          return;
        }
        app.globalData.ajax({
          url: 'index4.php',
          data: {
            submitok: 'onshow',
            openid: r.openid,
            unionid: r.unionid,
            aid: app.globalData.aid
          },
          success: function (a) {
            if (1 == a.flag && a.cook_flag != r.flag) {
              r.flag = a.cook_flag;
              uni.setStorageSync('COOK_U', r);
              return void that.upFn();
            }
          }
        });
      } else {
        switch (((a = app.globalData.index_par), this.reset_par(), a.sokind)) {
          case 'gps':
            that.setData({
              currentTab: 1
            });
            break;
          case 'match':
            that.setData({
              currentTab: 2
            });
            break;
          case 'ext':
            that.setData({
              currentTab: a.sex
            });
        }
        that.init();
      }
    } else {
      a = app.globalData.hn_par;
      this.reset_par();
      this.setData({
        currentTab: 0
      });
      that.init();
    }
  },
  onShareAppMessage: function (a) {
    return {
      imageUrl: this.SHARE.imgurl,
      title: this.SHARE.title,
      path: '/pages/index/index4?aid=' + app.globalData.aid
    };
  },
  onShareTimeline: function () {
    return {
      imageUrl: this.SHARE.imgurl,
      title: this.SHARE.title,
      query: 'aid=' + app.globalData.aid,
      path: '/pages/index/index4'
    };
  },
  methods: {
    reset_par: function () {
      this.setData({
        triggered: false,
        loading_flag: false,
        loading_str: '拼命加载中',
        ARR_index: [],
        waterfallList: [],
        ARR_index_nodata: false
      });
      i = 2;
      app.globalData.hn_par = {};
      app.globalData.index_par = {};
    },

    topbarFn: function (t) {
      var e = t.currentTarget.dataset.idx;
      this.setData({
        currentTab: e
      });
      this.reset_par();
      if (1 == this.iModuleU) {
        console.log('现在等于机', this.iModuleU)
        switch (e) {
          case 0:
            a = {};
            break;
          case 1:
            a = {
              sokind: 'gps'
            };
            break;
          case 2:
            a = {
              sokind: 'match'
            };
        }
      } else {
        switch (e) {
          case 0:
            a = {};
            break;
          case 1:
            a = {
              sokind: 'ext',
              sex: 1
            };
            break;
          case 2:
            a = {
              sokind: 'ext',
              sex: 2
            };
        }
      }
      this.init();
    },

    init: function () {
      var that = this;
      uni.showLoading({
        title: '玩命加载中...',
        mask: true
      });
      n = false;
      var o = {
        submitok: 'index',
        openid: (r = uni.getStorageSync('COOK_U')).openid,
        showtype: this.showtype,
        aid: app.globalData.aid
      };
      e.empty(a) || (o = JSON.parse((JSON.stringify(o) + JSON.stringify(a)).replace(/}{/, ',')));
      if (this.currentTab > 0) {
        this.setData({
          pxclass: '',
          sobox: false,
          sokind: ''
        });
      }
      app.globalData.ajax({
        url: 'user.php',
        data: o,
        success: function (a) {
          if (1 == a.flag) {
            var s;
            if (1 == a.iModuleU) {
              that.setData({
                topbar: ['推荐', '附近的', '匹配我']
              });
            } else {
              that.setData({
                topbar: ['推荐', '男嘉宾', '女嘉宾']
              });
            }
            if (0 == a.LIST.length || e.empty(a.LIST)) {
              console.log(a.LIST.length)
              console.log(a.LIST)
              that.setData({
                iModuleU: a.iModuleU,
                showtype: a.showtype,
                rz_dataARR: a.rz_dataARR,
                SHARE: a.SHARE,
                ARR_index: a.LIST,
                waterfallList: a.LIST,
                match: a.LIST,
                ARR_index_nodata: true,
                pxSO: a.pxSO,
                SO: a.SO,
                areaidARR: a.areaidARR,
                area2idARR: a.area2idARR
              });
            } else {
              that.setData({
                iModuleU: a.iModuleU,
                showtype: a.showtype,
                rz_dataARR: a.rz_dataARR,
                SHARE: a.SHARE,
                'ARR_index[0]': a.LIST,
                waterfallList: a.LIST,
                match: a.LIST,
                ARR_index_nodata: false,
                pxSO: a.pxSO,
                SO: a.SO,
                areaidARR: a.areaidARR,
                area2idARR: a.area2idARR
              });
            }
            var r = e.get_tabbar_index('my_msg');
            a.btmnewnum > 0
                ? uni.setTabBarBadge({
                  index: r,
                  text: a.btmnewnum
                })
                : uni.removeTabBarBadge({
                  index: r
                });
          } else {
            a.this = that;
            a.url = 'no';
            e.sorry(a);
          }
          uni.hideLoading();
          n = true;
        }
      });
    },

    showtypeFn: function () {
      this.setData({
        showtype_box: true,
        mask_class: 'alpha0_100'
      });
    },

    showtype_setFn: function (a) {
      var t = a.currentTarget.dataset.value;
      this.setData({
        showtype: t
      });
    },

    showtype_box_closeFn: function (a) {
      var that = this;
      var i = a.currentTarget.dataset.maskid;
      this.setData({
        mask_class: 'alpha100_0'
      });
      setTimeout(function () {
        that.setData(t({}, i, false));
      }, 500);
    },

    mask_closeFn: function (a) {
      var e = a.currentTarget.dataset.maskid;
      this.setData(
          t(
              {
                mask_class: 'alpha100_0'
              },
              e,
              false
          )
      );
      this.back();
    },

    gpsFn: function () {
      var that = this;
      uni.getFuzzyLocation({
        success: function (e) {
          app.globalData.ajax({
            url: 'user.php',
            data: {
              submitok: 'gps_save',
              longitude: e.longitude,
              latitude: e.latitude,
              openid: r.openid,
              aid: app.globalData.aid
            },
            success: function (e) {
              1 == e.flag
                  ? (that.setData({
                    div_gps: false,
                    currentTab: 1
                  }),
                      that.reset_par(),
                      (a = {
                        sokind: 'gps'
                      }),
                      that.init())
                  : uni.showToast({
                    title: e.msg,
                    icon: 'none',
                    mask: true
                  });
            }
          });
        },
        fail: function (a) {
          'getFuzzyLocation:fail system permission denied' == a.errMsg
              ? uni.showModal({
                content: '亲，请开启手机定位再来操作哦',
                confirmColor: that.color,
                confirmText: '朕知道了',
                showCancel: false,
                success: function (a) {
                }
              })
              : uni.showModal({
                content: '请设置：位置信息 > 使用小程序时允许',
                success: function (a) {
                  if (a.confirm) {
                    uni.openSetting({
                      success: function (a) {
                        console.log(a.authSetting);
                        a.authSetting = {
                          'scope.userInfo': true,
                          'scope.userLocation': true
                        };
                      }
                    });
                  }
                }
              });
        }
      });
    },

    dataFn: function () {
      uni.navigateTo({
        url: '/pagesA/reg/reg'
      });
    },

    setloading: function (a, t) {
      'start' == a
          ? this.setData({
            loading_flag: true,
            loading_ico_flag: true,
            loading_str: t
          })
          : this.setData({
            loading_flag: false,
            loading_ico_flag: false,
            loading_str: t
          });
    },

    upFn: function (t) {
      var that = this;
      uni.vibrateShort({
        type: 'heavy'
      });
      app.globalData.hn_par = {};
      setTimeout(function () {
        that.setData({
          triggered: false,
          loading_flag: false,
          loading_str: '拼命加载中',
          ARR_index: [],
          waterfallList: [],
          ARR_index_nodata: false,
          guestloadP_flag: false,
          sokind: '',
          currentTab: 0
        });
        i = 2;
        a = {};
        that.init();
      }, 500);
    },

    btmFn: function (o) {
      var d = this.ARR_index;
      var that = this;
      if (n) {
        n = false;
        that.setloading('start', '玩命加载中');
        var l = {
          submitok: 'index',
          p: i,
          openid: r.openid,
          aid: app.globalData.aid
        };
        e.empty(a) || (l = JSON.parse((JSON.stringify(l) + JSON.stringify(a)).replace(/}{/, ',')));
        app.globalData.ajax({
          url: 'user.php',
          data: l,
          success: function (a) {
            if (i > a.guestloadP && a.guestloadP > 0 && 1 != a.iflogin) {
              that.setloading('stop', '请登录/注册');
              n = false;
              return void that.setData({
                guestloadP_flag: true,
                iflogin: a.iflogin
              });
            }
            if (1 == a.flag) {
              var e = d.length;
              if (a.LIST.length < 1) {
                that.setloading('end', '已全部加载完毕');
                return void (n = false);
              }
              that.setData(t({}, 'ARR_index[' + e + ']', a.LIST));
              that.waterfallList = that.waterfallList.concat(a.LIST);
              that.match = a.LIST
              i += 1;
              n = true;
            } else {
              uni.showToast({
                title: a.msg,
                icon: 'none',
                mask: true
              });
            }
            that.setloading('end', '上拉加载更多');
          }
        });
      }
    },

    backtopFn: function (a) {
      var e = 'scrolltopNum_' + a.currentTarget.dataset.id;
      this.setData(t({}, e, 0));
    },

    binnd_scroll_index: function (a) {
      a.detail.scrollTop > 100
          ? this.setData({
            backtop_flag_index: true
          })
          : this.setData({
            backtop_flag_index: false
          });
    },
    pxFn: function () {
      var a;
      var t;
      'ed' == this.pxclass ? ((t = false), (a = '')) : ((a = 'ed'), (t = true));
      this.setData({
        pxclass: a,
        sobox: t
      });
    },

    souboxFn: function (t) {
      var e = t.currentTarget.dataset.sokind;
      a = {
        sokind: e
      };
      this.reset_par();
      this.setData({
        sokind: e,
        currentTab: 0
      });
      this.init();
    },

    px_ageFn: function (i) {
      var n;
      var s = i.detail.value;
      if (s[0] > s[1]) {
        uni.showToast({
          title: '必须左小右大哦',
          icon: 'none'
        });
        return false;
      }
      var r = this.pxSO.age.arr[0];
      var o = e.idx_iv(s, r);
      var d = o[0];
      var c = (o[1], d.split(','));
      this.reset_par();
      this.setData((t((n = {}), 'pxSO.age.def', c), t(n, 'currentTab', 0), n));
      a = {
        sokind: 'ext',
        age: d
      };
      this.init();
    },

    px_heighFn: function (i) {
      var n;
      var s = i.detail.value;
      if (s[0] > s[1]) {
        uni.showToast({
          title: '必须左小右大哦',
          icon: 'none'
        });
        return false;
      }
      var r = this.pxSO.heigh.arr[0];
      var o = e.idx_iv(s, r);
      var d = o[0];
      var c = (o[1], d.split(','));
      this.reset_par();
      this.setData((t((n = {}), 'pxSO.heigh.def', c), t(n, 'currentTab', 0), n));
      a = {
        sokind: 'ext',
        heigh: d
      };
      this.init();
    },

    moreFn: function () {
      var a;
      a = 'ed' == this.somoreclass ? '' : 'ed';
      this.setData({
        index_so_flag: true,
        index_so_mask_class: 'alpha0_100',
        index_so_box_class: 'div_leftAnm1',
        somoreclass: a
      });
    },

    index_so_closeFn: function () {
      var that = this;
      this.setData({
        index_so_mask_class: 'alpha100_0',
        index_so_box_class: 'div_leftAnm2',
        somoreclass: ''
      });
      setTimeout(function () {
        that.setData({
          index_so_flag: false
        });
      }, 400);
    },

    rangFn: function (a) {
      a.currentTarget.dataset.f;
      var i;
      var n = a.currentTarget.dataset.index;
      var s = a.detail.value;
      if (s[0] > s[1]) {
        uni.showToast({
          title: '请选择左小右大范围',
          icon: 'none',
          mask: true
        });
      } else {
        var r = e.idx_iv(s, this.SO[n].arr.arr[0]);
        this.setData((t((i = {}), 'SO[' + n + '].i', r[0]), t(i, 'SO[' + n + '].v', r[1]), i));
      }
    },

    index_SO_onoffFn: function (a) {
      var e;
      var i = a.currentTarget.dataset.index;
      e = 'on' == this.SO[i].onoff ? 'off' : 'on';
      this.setData(t({}, 'SO[' + i + '].onoff', e));
    },

    index_SO_liFn: function (a) {
      if ('vip' != a.currentTarget.dataset.auth) {
        var i;
        var n = a.currentTarget.dataset.idx;
        var s = a.currentTarget.dataset.i;
        var r = a.currentTarget.dataset.fkind;
        var o = this.SO[n].i;
        i = e.empty(o) ? s : 'checkbox' == r ? (e.indexOf(o, s) ? (i = e.json_remove(o, s)).join(',') : o + ',' + s) : s;
        if (0 == s) {
          i = 0;
        }
        this.setData(t({}, 'SO[' + n + '].i', i));
      } else {
        this.vipFn();
      }
    },

    index_SO_submitFn: function (t) {
      (a = t.detail.value).keyword = this.keyword;
      this.reset_par();
      this.index_so_closeFn();
      this.setData({
        currentTab: 0
      });
      this.init();
    },

    index_SO_resetFn: function (a) {
      var e = this.SO;
      for (var i in e) {
        var n;
        this.setData((t((n = {}), 'SO[' + i + '].i', 0), t(n, 'SO[' + i + '].v', ''), n));
      }
      this.setData({
        keyword: ''
      });
    },

    vipFn: function () {
      app.globalData.chklogin().then(function (a) {
        a
            ? uni.navigateTo({
              url: '/pagesA/my_vip/my_vip'
            })
            : uni.navigateTo({
              url: '/pages/login/login'
            });
      });
    },

    areaidFn: function (a) {
      for (var i, n = a.currentTarget.dataset.kind, s = (a.currentTarget.dataset.f, a.detail.value), r = a.currentTarget.dataset.idx, o = [], d = 0; d < s.length; d++) {
        if (s[d] > 0) {
          o.push(s[d] - 1);
        }
      }
      s = o;
      if ('hj' == n) {
        var c = e.areaGetTtitle(s, this.area2idARR);
      } else {
        c = e.areaGetTtitle(s, this.areaidARR);
      }
      var l = c[0];
      var u = c[1];
      this.setData((t((i = {}), 'SO[' + r + '].i', l), t(i, 'SO[' + r + '].v', u), i));
    },

    areaidChangeFn: function (a) {
      var i;
      var n = a.currentTarget.dataset.kind;
      var s = a.detail.column;
      var r = a.detail.value;
      var o = a.currentTarget.dataset.idx;
      var d = 'hj' == n ? 4 : parseInt(this.SO[o].arealeval);
      var c = {
        def: this.SO[o].arr.def,
        idx: this.SO[o].arr.idx
      };
      if ('hj' == n) {
        var l = this.area2idARR.ARR1;
        var u = this.area2idARR.ARR2;
        var g = this.area2idARR.ARR3;
        var h = this.area2idARR.ARR4;
      } else {
        l = this.areaidARR.ARR1;
        u = this.areaidARR.ARR2;
        g = this.areaidARR.ARR3;
        h = this.areaidARR.ARR4;
      }
      var f;
      var _;
      var x;
      var p = [
        {
          i: '0',
          v: '不限',
          f: '0'
        }
      ];
      var b = l;
      var R = [];
      var v = [];
      var k = [];
      switch (((b = p.concat(b)), s)) {
        case 0:
          if (0 == r) {
            switch (((c.def[0] = b), d >= 2 && (c.def[1] = p), d >= 3 && (c.def[2] = p), d >= 4 && (c.def[3] = p), d)) {
              case 1:
                c.idx = [0];
                break;
              case 2:
                c.idx = [0, 0];
                break;
              case 3:
                c.idx = [0, 0, 0];
                break;
              case 4:
                c.idx = [0, 0, 0, 0];
            }
          } else {
            switch (((f = l[r - 1].i), d)) {
              case 1:
                c.def = [b];
                c.idx = [r];
                break;
              case 2:
                R = p.concat(e.areaNEW(f, u));
                c.def = [b, R];
                c.idx = [r, 0];
                break;
              case 3:
                R = p.concat(e.areaNEW(f, u));
                c.def = [b, R, p];
                c.idx = [r, 0, 0];
                break;
              case 4:
                R = p.concat(e.areaNEW(f, u));
                c.def = [b, R, p, p];
                c.idx = [r, 0, 0, 0];
            }
          }
          break;
        case 1:
          if (0 == r) {
            if (d >= 3) {
              c.def[2] = p;
            }
            if (d >= 4) {
              c.def[3] = p;
            }
            if (d >= 2) {
              c.idx[1] = r;
            }
            if (d >= 3) {
              c.idx[2] = 0;
            }
            if (d >= 4) {
              c.idx[3] = 0;
            }
          } else {
            switch (d) {
              case 2:
                c.idx[1] = r;
                break;
              case 3:
                f = l[c.idx[0] - 1].i;
                _ = (R = p.concat(e.areaNEW(f, u)))[r].i;
                v = p.concat(e.areaNEW(_, g));
                c.def[2] = v;
                c.idx[1] = r;
                c.idx[2] = 0;
                break;
              case 4:
                f = l[c.idx[0] - 1].i;
                _ = (R = p.concat(e.areaNEW(f, u)))[r].i;
                v = p.concat(e.areaNEW(_, g));
                c.def[2] = v;
                c.def[3] = p;
                c.idx[1] = r;
                c.idx[2] = 0;
                c.idx[3] = 0;
            }
          }
          break;
        case 2:
          if (0 == r) {
            if (d >= 4) {
              c.def[3] = p;
            }
            if (d >= 3) {
              c.idx[2] = r;
            }
            if (d >= 4) {
              c.idx[3] = 0;
            }
          } else {
            switch (d) {
              case 3:
                c.idx[2] = r;
                break;
              case 4:
                f = l[c.idx[0] - 1].i;
                _ = (R = p.concat(e.areaNEW(f, u)))[c.idx[1]].i;
                x = (v = p.concat(e.areaNEW(_, g)))[r].i;
                k = p.concat(e.areaNEW(x, h));
                c.def[3] = k;
                c.idx[2] = r;
                c.idx[3] = 0;
            }
          }
          break;
        case 3:
          if (d >= 4) {
            c.idx[3] = r;
          }
      }
      this.setData((t((i = {}), 'SO[' + o + '].arr.def', c.def), t(i, 'SO[' + o + '].arr.idx', c.idx), i));
    },

    index_SO_uid_submitFn: function (t) {
      a = t.detail.value;
      this.setData({
        keyword: a.keyword
      });
      this.index_so_closeFn();
      this.reset_par();
      this.setData({
        currentTab: 0
      });
      this.init();
    },

    index_SO_uid_submitFn2: function (t) {
      var e = t.detail.value;
      this.index_so_closeFn();
      this.reset_par();
      a = {
        sokind: 'keyword',
        keyword: e
      };
      this.setData({
        currentTab: 0
      });
      this.init();
    },

    index_SO_uid_bindblurFn: function (a) {
      var t = a.detail.value;
      this.setData({
        keyword: t
      });
    },

    getPhoneNumber: function (a) {
      app.globalData.getPhoneNumber({
        e: a,
        url: '/pages/reg/reg',
        urlkind: 'navigateTo'
      });
    },

    back: function () {
      this.setData({
        div_login: false,
        currentTab: 0
      });
      this.reset_par();
      a = {
        sokind: ''
      };
      this.init();
    },

    emptyFn: function () {
    },

    ifagreeFn: function (a) {
      1 == a.detail.value
          ? this.setData({
            ifagree: true
          })
          : this.setData({
            ifagree: false
          });
    },

    ifagree_passFn: function () {
      uni.showToast({
        title: '请先点击同意《用户协议》和《隐私条款》',
        icon: 'none',
        mask: true,
        duration: 3000
      });
    },

    privacy_agree: function (a) {
      console.log('agree');
    },

    privacy_disagree: function (a) {
      console.log('disagree');
      uni.exitMiniProgram();
    },

    certFn() {
      console.log('占位：函数 certFn 未声明');
    },
    //
    handleLike(data) {
      console.log('这是什么函数', data);
    },
    handlePass(data) {
      console.log('===这是什么函数', data);

    },
    handleChange(nue, bloo) {
      if (bloo && nue < 5) {
        this.btmFn()
      }
    },

  }
};
</script>
<style>
@import './user.css';
</style>
